﻿#include "GuiUnitTestSnapshotViewerIncludes.h"

namespace vl
{
	namespace presentation
	{
		namespace user_resource
		{
			using namespace collections;
			using namespace stream;
			using namespace controls;

			class GuiUnitTestSnapshotViewerResourceReader
			{
			public:
				static const vint parserBufferLength = 480; // 830 bytes before compressing
				static const vint parserBufferBlock = 1024;
				static const vint parserBufferRemain = 480;
				static const vint parserBufferRows = 1;
				static const char* parserBuffer[1];

				static void ReadToStream(vl::stream::MemoryStream& stream)
				{
					DecompressStream(parserBuffer, true, parserBufferRows, parserBufferBlock, parserBufferRemain, stream);
				}
			};

			const char* GuiUnitTestSnapshotViewerResourceReader::parserBuffer[] = {
				"\x3E\x03\x00\x00\xD8\x01\x00\x00\x63\x00\x01\x82\x80\x00\x81\x80\x1E\x29\x65\x73\x2F\x35\x32\x3B\x31\x33\x26\x65\x74\x21\x24\x31\x32\x88\x10\x27\x61\x6D\x25\x3D\x12\x17\x21\x3B\x34\x55\x6E\x29\x34\x34\x29\x84\x3B\x29\x6E\x61\x30\x33\x38\x37\x34\x3A\x2B\x69\x65\x37\x25\x32\x3A\x10\x10\x2B\x34\xF3\x29\x2F\x3E\x34\x8D\x18\x17\x30\x22\x3E\x1C\x14\x25\x30\x39\x32\x6E\x64\x08\xA3\x31\x9B\x3B\x17\xA1\x2F\x08\x8A\x8C\x8E\x80\x8A\x88\x8A\x12\xBE\x05\x03\x82\x80\x08\xAF\x80\x5E\x81\x8C\x2F\x33\x31\x30\x37\x34\x7A\x65\x24\x33\x24\x3A\x39\x34\x37\x67\x73\x06\x1F\xA0\x03\xB9\x81\x29\x63\x6E\xB0\x34\x38\x04\xB9\xBF\x80\x49\x6E\x33\x32\x8E\x36\x84\x02\xBA\x87\x81\xA5\x98\x34\x3F\x04\xBA\xC7\x01\xC3\x2C\x21\x33\x3B\x38\x8C\x8D\x08\xE3\x2F\x32\x34\x34\xB8\x00\x01\x74\x8C\x21\xC2\x87\x21\x33\x31\x23\x48\xC3\x3C\x86\x39\x37\x32\xCE\xCF\x01\x74\x83\x12\xD2\x83\x20\x38\x38\x9E\xDB\x9F\xB3\xDF\xAD\x04\xBA\xDF\x91\xB7\xEA\xCD\x30\x3A\x39\x85\x39\x6A\x9D\x34\xAA\xE1\x86\x8C\x90\x91\x24\xA6\xA8\x8A\x9C\x96\x94\x98\x99\x34\xAE\x23\x37\xDC\xDC\xAD\xC4\xEF\x02\x97\xE5\x39\x04\xBC\xF1\xE7\x8F\x21\xA3\xA5\x83\xC3\xEB\x95\x97\x97\x31\xB3\xB2\x3D\xE3\x80\xE0\xAE\xFB\x4E\x1B\xED\x26\xB1\xC3\x30\x37\x3A\x4A\x61\x5C\x56\x80\x2E\x2E\x0F\x09\x81\x07\x86\x85\x6B\x18\x55\x09\x1E\x08\x1A\xF4\x42\x41\x04\x5D\x13\x81\x48\x42\x19\x6C\x25\x13\x18\x1D\x3B\x6E\x1D\x7F\x7F\x4A\x79\x04\x5E\x88\x01\x48\x86\x8A\x81\x17\x99\x8B\x85\x87\x2F\x14\x19\x1F\x51\x45\x73\x19\x5D\x1A\x7B\x5B\x6E\x52\x73\x29\x9A\x8C\x84\x4F\x50\x3F\x77\x1B\x5B\x0F\x91\x81\x42\x68\x5F\x44\x90\x03\x14\x0B\x4D\x45\x1A\x11\x6F\x2C\x1A\x52\x1C\x76\x5C\x51\x94\x92\x54\x65\x1E\x67\x02\x74\x58\x91\x40\x14\xC6\x5A\x64\x71\x1A\x19\x9D\x64\x5D\x6C\x5F\x5F\x73\x40\x64\x5C\x68\x92\x64\x65\x96\x59\x45\x19\x66\x9B\x64\x14\x98\x57\x2D\x34\x55\x9D\x40\x67\x26\x67\x5A\x18\x5F\x1A\x6E\x19\x5B\x4D\xB3\x1A\x0E\x0E\xE9\x51\x7C\x79\x4A\xEE\x56\x71\x7C\x4D\x57\x2F\x54\x1B\x1B\x77\x1E\x60",
				};

			class GuiUnitTestSnapshotViewerResourceLoaderPlugin : public Object, public IGuiPlugin
			{
			public:

				GUI_PLUGIN_NAME(GacGen_GuiUnitTestSnapshotViewerResourceLoader)
				{
					GUI_PLUGIN_DEPEND(GacUI_Res_Resource);
					GUI_PLUGIN_DEPEND(GacUI_Res_TypeResolvers);
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
					GUI_PLUGIN_DEPEND(GacUI_Instance_Reflection);
					GUI_PLUGIN_DEPEND(GacUI_Compiler_WorkflowTypeResolvers);
#endif
				}

				void Load(bool controllerUnrelatedPlugins, bool controllerRelatedPlugins)override
				{
					if (controllerRelatedPlugins)
					{
						List<GuiResourceError> errors;
						MemoryStream resourceStream;
						GuiUnitTestSnapshotViewerResourceReader::ReadToStream(resourceStream);
						resourceStream.SeekFromBegin(0);
						GetResourceManager()->LoadResourceOrPending(resourceStream, GuiResourceUsage::InstanceClass);
					}
				}

				void Unload(bool controllerUnrelatedPlugins, bool controllerRelatedPlugins)override
				{
				}
			};
			GUI_REGISTER_PLUGIN(GuiUnitTestSnapshotViewerResourceLoaderPlugin)
		}
	}
}
